Repository navigation
Mockgun: implement upload - #469
Open
patrickwolf wants to merge 1 commit into
Open
patrickwolf wants to merge 1 commit into
patrickwolf wants to merge 1 commit into
Conversation
upload raised NotImplementedError. It now validates the path and the field as the server does and creates the records an upload leaves: an Attachment linked to the entity, holding the file's name, size and tags, and the File/Link field pointing at it. A thumbnail field sets the entity's image field. The file itself is not stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
patrickwolf
force-pushed
the
mockgun-upload
branch
from
November 16, 2026 17:45
07ee2dc to
0882427
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Mockgun.uploadraisesNotImplementedError, so any code that uploads (a movie to a Version, a file to a Shot) cannot be tested on Mockgun.Change
uploadnow leaves the records an upload leaves on the server, without storing the file:Shotgun.upload: the entity must exist, the path must be an existing non-empty file, andfield_namemust be a File/Link field. Each failure raisesShotgunError.attachment_links), withfilename,display_name,file_size,file_extension, the entity'sprojectand an optionalcreated_at. Fields the site's schema lacks are skipped.tag_list, a comma-separated string as forShotgun.upload, sets the Attachment'stag_listto the tag names.this_fileand the entity'sfield_nameget the same value the server gives:type,id,name,link_type: "upload",content_type, and aurlof the form<server>/file_serve/attachment/<id>.thumb_image,filmstrip_thumb_image,image,filmstrip_image) the entity'simageorfilmstrip_imageis set to that URL.Downloading the file back is a separate PR built on this one.
Tests
TestUpload: upload to a File/Link field, without a field, with tags, to a thumbnail field, and each validation error.Merge order
Independent of the other Mockgun PRs (field types, default value types, limit and page), but each of them also adds its test class at the end of
tests/test_mockgun.py. Whichever is merged later needs a rebase that keeps both test classes. The download PR builds on this one and goes in after it.